home *** CD-ROM | disk | FTP | other *** search
- global gCDvolume, gCPU, gBreedDatabase, gBreedDatabaseCount, gBreedDatabaseByGroup, gBreedJumpIndex, gBreedCameFromFetch, gpBreedNameSprite, gpBreedSmallSprite, gpBreedBigSprite, gpBreedVideoSprite, gpBreedTextSprite, gpBreedVideoIsOn, gpBreedBigIsLoaded, gpBreedVideoIsLoaded, gpBreedPanelContents, gpBreedFilePath, gpBreedAudioChannel, gpSelectionWindow, gpBreedIndex, gpBreedIndexInGroup, gpBreedGroupIndex, gpBreedIndexList, gpBreedMarker, gpBreedBackgroundCastnum, gpBreedSmallCastnum, gpBreedBigCastnum, gpBreedNameCastnum, gpBreedTextCastnum, gpBreedVideoCastnum, gpBreedSoundFile, gpBreedProfileArtSprite, gpBreedProfileTrackSprite, gpBreedProfileMarkerSprite, gpBreedProfileFetchSprite, gpBreedProfileToggleSprite, gpBreedProfileIsLoaded
-
- on initBreeds
- set gpBreedNameSprite to 45
- set gpBreedSmallSprite to 46
- set gpBreedBigSprite to 47
- set gpBreedVideoSprite to 48
- set gpBreedTextSprite to 22
- set gpBreedProfileArtSprite to 23
- set gpBreedProfileTrackSprite to 24
- set gpBreedProfileMarkerSprite to 25
- set gpBreedProfileFetchSprite to 33
- set gpBreedProfileToggleSprite to 41
- set gpBreedVideoIsOn to 0
- set gpBreedBigIsLoaded to 0
- set gpBreedVideoIsLoaded to 0
- set gpBreedProfileIsLoaded to 0
- set gBreedCameFromFetch to 0
- set gpBreedMarker to "breeds"
- set gpBreedAudioChannel to 1
- set gpBreedBackgroundCastnum to the number of cast "BreedHolder.bkg"
- set gpBreedNameCastnum to the number of cast "BreedHolder.nam"
- set gpBreedTextCastnum to the number of cast "BreedHolder.txt"
- set gpBreedSmallCastnum to the number of cast "BreedHolder.sml"
- set gpBreedBigCastnum to the number of cast "BreedHolder.big"
- set gpBreedVideoCastnum to the number of cast "BreedHolder.mov"
- set gBreedJumpIndex to getAt(getAt(gBreedDatabaseByGroup, 1), 1)
- set gpBreedIndex to -1
- end
-
- on enterBreed
- setHelpContext(getBreedMarker())
- loadBreedByIndex(gBreedJumpIndex)
- set gBreedCameFromFetch to 0
- end
-
- on exitBreed
- closeSelectionMIAW()
- sound stop gpBreedAudioChannel
- disableBreedPuppets()
- showAllSprites()
- end
-
- on getBreedMarker
- return gpBreedMarker
- end
-
- on loadBreedByIndex theIndex
- clearBreedBooleans()
- set theRecord to getBreedRecord(theIndex)
- set theCode to getFieldBreedCode(theRecord)
- set theGroup to getFieldGroupCode(theRecord)
- set oldIndex to gpBreedIndex
- set gpBreedIndex to theIndex
- set gBreedJumpIndex to theIndex
- set gpBreedGroupIndex to findPos(gBreedDatabaseByGroup, theGroup)
- set gpBreedIndexList to getAt(gBreedDatabaseByGroup, gpBreedGroupIndex)
- set gpBreedIndexInGroup to getPos(gpBreedIndexList, theIndex)
- if gCPU = #mac then
- set gpBreedFilePath to gCDvolume & ":data:breeds:" & theGroup & ":" & theCode & ":" & theCode
- else
- set gpBreedFilePath to gCDvolume & "\data\breeds\" & theGroup & "\" & theCode & "\" & theCode
- end if
- hideBreedElements()
- setBreedGroupArt(theGroup)
- if theIndex = oldIndex then
- putDebug("Breed" && theIndex && "is already loaded.")
- else
- relink(gpBreedNameCastnum, gpBreedFilePath & "1.pic")
- importTextInto(gpBreedTextCastnum, gpBreedFilePath & "2.txt")
- relink(gpBreedSmallCastnum, gpBreedFilePath & "3.pic")
- end if
- set gpBreedSoundFile to gpBreedFilePath & "7.aif"
- enableBreedPuppets()
- showBreedElements()
- end
-
- on clearBreedBooleans
- set gpBreedVideoIsOn to 0
- set gpBreedBigIsLoaded to 0
- set gpBreedVideoIsLoaded to 0
- set gpBreedProfileIsLoaded to 0
- end
-
- on hideBreedElements
- sound stop gpBreedAudioChannel
- hideSprite(gpBreedNameSprite)
- hideSprite(gpBreedVideoSprite)
- QTstop(gpBreedVideoSprite)
- hideSprite(gpBreedSmallSprite)
- hideSprite(gpBreedBigSprite)
- hideSprite(gpBreedTextSprite)
- hideSprite(gpBreedProfileArtSprite)
- hideSprite(gpBreedProfileToggleSprite)
- hideSprite(gpBreedProfileToggleSprite + 1)
- hideBreedProfileMarkers()
- hideBreedFetchMarkers()
- updateStage()
- end
-
- on showBreedElements
- showSprite(gpBreedNameSprite)
- showSprite(gpBreedSmallSprite)
- if gBreedCameFromFetch = 1 then
- showBreedProfile()
- else
- showBreedText()
- end if
- end
-
- on NextBreed
- closeSelectionMIAW()
- hideBreedElements()
- if gpBreedIndexInGroup < count(gpBreedIndexList) then
- set theIndex to getAt(gpBreedIndexList, gpBreedIndexInGroup + 1)
- else
- set gpBreedGroupIndex to gpBreedGroupIndex + 1
- if gpBreedGroupIndex > count(gBreedDatabaseByGroup) then
- set gpBreedGroupIndex to 1
- end if
- set theIndex to getAt(getAt(gBreedDatabaseByGroup, gpBreedGroupIndex), 1)
- end if
- loadBreedByIndex(theIndex)
- end
-
- on PrevBreed
- closeSelectionMIAW()
- hideBreedElements()
- if gpBreedIndexInGroup > 1 then
- set theIndex to getAt(gpBreedIndexList, gpBreedIndexInGroup - 1)
- else
- set gpBreedGroupIndex to gpBreedGroupIndex - 1
- if gpBreedGroupIndex < 1 then
- set gpBreedGroupIndex to count(gBreedDatabaseByGroup)
- end if
- set gpBreedIndexList to getAt(gBreedDatabaseByGroup, gpBreedGroupIndex)
- set theIndex to getAt(gpBreedIndexList, count(gpBreedIndexList))
- end if
- loadBreedByIndex(theIndex)
- end
-
- on handleBreedSelectADog
- QTstop(gpBreedVideoSprite)
- updateStage()
- hideSprite(gpBreedVideoSprite)
- updateStage()
- set theString to EMPTY
- repeat with i = 1 to gBreedDatabaseCount - 1
- set theString to theString & getFieldDisplayName(getAt(gBreedDatabase, i)) & RETURN
- end repeat
- set theString to theString & getFieldDisplayName(getAt(gBreedDatabase, gBreedDatabaseCount))
- set theCallback to "tell the stage to loadBreedByIndex(theIndex)"
- openSelectionMIAW(theString, "Select A Pet", theCallback)
- end
-
- on handleBreedCamera
- closeSelectionMIAW()
- if the movieRate of sprite gpBreedVideoSprite > 0 then
- hideSprite(gpBreedSmallSprite)
- set gpBreedVideoIsOn to 0
- QTstop(gpBreedVideoSprite)
- updateStage()
- hideSprite(gpBreedVideoSprite)
- updateStage()
- end if
- if gpBreedBigIsLoaded = 0 then
- relink(gpBreedBigCastnum, gpBreedFilePath & "4.pic")
- set gpBreedBigIsLoaded to 1
- end if
- showSprite(gpBreedBigSprite)
- updateStage()
- showSprite(gpBreedSmallSprite)
- end
-
- on handleBreedProjector
- closeSelectionMIAW()
- if the movieRate of sprite gpBreedVideoSprite <> 0 then
- set gpBreedVideoIsOn to 0
- QTstop(gpBreedVideoSprite)
- updateStage()
- hideSprite(gpBreedVideoSprite)
- updateStage()
- else
- if gpBreedVideoIsLoaded = 0 then
- relink(gpBreedVideoCastnum, gpBreedFilePath & "6.mov")
- set gpBreedVideoIsLoaded to 1
- updateStage()
- end if
- QTrewind(gpBreedVideoSprite)
- showSprite(gpBreedVideoSprite)
- updateStage()
- QTplay(gpBreedVideoSprite)
- set gpBreedVideoIsOn to 1
- updateStage()
- set the sound of cast gpBreedVideoCastnum to 1
- end if
- end
-
- on checkBreedVideo
- if (gpBreedVideoIsOn = 1) and (the movieRate of sprite gpBreedVideoSprite = 0) and (the movieTime of sprite gpBreedVideoSprite > 1) then
- hideSprite(gpBreedVideoSprite)
- set gpBreedVideoIsOn to 0
- end if
- end
-
- on handleBreedAudio
- if soundBusy(gpBreedAudioChannel) then
- sound stop gpBreedAudioChannel
- else
- putDebug("playing soundFile" && gpBreedSoundFile)
- sound playFile gpBreedAudioChannel, gpBreedSoundFile
- end if
- end
-
- on handleBreedSmallArea
- handleBreedCamera()
- end
-
- on handleBreedBigArea
- hideSprite(gpBreedBigSprite)
- end
-
- on handleBreedVideoArea
- QTstop(gpBreedVideoSprite)
- updateStage()
- hideSprite(gpBreedVideoSprite)
- updateStage()
- end
-
- on handleBreedText
- if gpBreedPanelContents = #text then
- showBreedProfile()
- else
- showBreedText()
- end if
- end
-
- on showBreedText
- hideBreedProfileMarkers()
- hideSprite(gpBreedProfileToggleSprite)
- hideSprite(gpBreedProfileArtSprite)
- showSprite(gpBreedTextSprite)
- set gpBreedPanelContents to #text
- end
-
- on showBreedProfile
- if gpBreedProfileIsLoaded = 0 then
- set gpBreedProfileIsLoaded to 1
- set profileList to getFieldProfile(getAt(gBreedDatabase, gpBreedIndex))
- set fetchList to getFetchValueList()
- set deltaH to the width of sprite gpBreedProfileTrackSprite / 4
- set numCriteria to 8
- putDebug("profileList =" && profileList)
- putDebug("fetchList =" && fetchList)
- repeat with i = 1 to numCriteria
- set theValue to getAt(profileList, i)
- set theLocH to the locH of sprite gpBreedProfileTrackSprite + ((theValue - 1) * deltaH)
- set the locH of sprite (gpBreedProfileMarkerSprite + i - 1) to theLocH
- set theValue to getAt(fetchList, i)
- if theValue > 0 then
- set theLocH to the locH of sprite gpBreedProfileTrackSprite + ((theValue - 1) * deltaH)
- set the locH of sprite (gpBreedProfileFetchSprite + i - 1) to theLocH
- next repeat
- end if
- set the locH of sprite (gpBreedProfileFetchSprite + i - 1) to -100
- end repeat
- updateStage()
- end if
- hideSprite(gpBreedTextSprite)
- showSprite(gpBreedProfileArtSprite)
- showBreedProfileMarkers()
- showSprite(gpBreedProfileToggleSprite)
- set gpBreedPanelContents to #profile
- end
-
- on toggleBreedFetchMarkers
- showBreedFetchMarkers()
- showSprite(gpBreedProfileToggleSprite + 1)
- updateStage()
- delayTicks(60)
- repeat while the stillDown
- nothing()
- end repeat
- hideBreedFetchMarkers()
- hideSprite(gpBreedProfileToggleSprite + 1)
- updateStage()
- end
-
- on showBreedProfileMarkers
- repeat with i = 0 to 7
- showSprite(gpBreedProfileMarkerSprite + i)
- end repeat
- end
-
- on hideBreedProfileMarkers
- repeat with i = 0 to 7
- hideSprite(gpBreedProfileMarkerSprite + i)
- end repeat
- end
-
- on showBreedFetchMarkers
- repeat with i = 0 to 7
- showSprite(gpBreedProfileFetchSprite + i)
- end repeat
- end
-
- on hideBreedFetchMarkers
- repeat with i = 0 to 7
- hideSprite(gpBreedProfileFetchSprite + i)
- end repeat
- end
-
- on enableBreedPuppets
- repeat with i = 0 to 7
- safePuppetSprite(gpBreedProfileMarkerSprite + i, 1)
- safePuppetSprite(gpBreedProfileFetchSprite + i, 1)
- end repeat
- end
-
- on disableBreedPuppets
- repeat with i = 0 to 7
- puppetSprite(gpBreedProfileMarkerSprite + i, 0)
- puppetSprite(gpBreedProfileFetchSprite + i, 0)
- end repeat
- end
-
- on setBreedGroupArt theGroupCode
- if gCPU = #mac then
- set theFile to gCDvolume & ":data:breeds:" & theGroupCode & ":aabkg.pic"
- else
- set theFile to gCDvolume & "\data\breeds\" & theGroupCode & "\aabkg.pic"
- end if
- relink(gpBreedBackgroundCastnum, theFile)
- updateStage()
- end
-
- on setBreedBackground theIndex
- set theRecord to getAt(gBreedDatabase, theIndex)
- set theGroupCode to getFieldGroupCode(theRecord)
- if gCPU = #mac then
- set theFile to gCDvolume & ":data:breeds:" & theGroupCode & ":aabkg.pic"
- else
- set theFile to gCDvolume & "\data\breeds\" & theGroupCode & "\aabkg.pic"
- end if
- relink(gpBreedBackgroundCastnum, theFile)
- end
-
- on handleBreedPrinter
- set theAnswer to confirm("Would you like to print the information for this pet?")
- if theAnswer = 0 then
- exit
- end if
- waitCursor()
- puppetSound("printing.aif")
- updateStage()
- set theName to getFieldDisplayName(getAt(gBreedDatabase, gpBreedIndex))
- set theTitle to theName && "- Pet Information"
- if gpBreedBigIsLoaded = 0 then
- relink(gpBreedBigCastnum, gpBreedFilePath & "4.pic")
- set gpBreedBigIsLoaded to 1
- end if
- printReport(theTitle, gpBreedSmallCastnum, gpBreedTextCastnum)
- printPICT(the picture of cast gpBreedBigCastnum, theName)
- pointerCursor()
- end
-